﻿using UnityEngine;
using System.Collections;

public class Blink : MonoBehaviour {
	
	RaycastHit hit;
	
	public GameObject Player;
	
	private float raycastLength = 500;
	
	void Update()
	{
		
		
		Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
		
		if (Physics.Raycast (ray, out hit, raycastLength)) {
			if (hit.collider.name == "Terrain") {
				
				if (Input.GetMouseButtonDown (1)) {
					GameObject TargetObj = Instantiate (Player, hit.point, Quaternion.identity) as GameObject;
					TargetObj.name = "Player";
					
					
					
				}
			}
			
			
			
			
			
		}
		
		
	}
	
}